package pers.mobian.springfirst.factorybean;

import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.context.annotation.AnnotatedBeanDefinitionReader;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
import pers.mobian.springfirst.config.AppConfig;

/**
 * @Date 2021/9/7 22:55
 * @Created mobian
 * @Description
 */
public class test02 {
	public static void main(String[] args) {
//		AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class);
		AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext("");
//		context.refresh();
//		AnnotatedBeanDefinitionReader annotatedBeanDefinitionReader = new AnnotatedBeanDefinitionReader(context);

//		annotatedBeanDefinitionReader.register(MoBian.class);
		System.out.println(context.getBean("moBian"));


//		XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(context);
//		// 返回注册的Bean数量
//		int i = xmlBeanDefinitionReader.loadBeanDefinitions("spring-test.xml");
//		System.out.println(i);
//		System.out.println(context.getBean("moBian"));


//		context.refresh();
//
//		ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context);
//		scanner.scan("pers.mobian.springfirst.factorybean");
//
//		System.out.println(context.getBean("moBian"));
	}
}
